<template>
  <div class="assemble">
    <header>
      <div class="assemble_header">
        <img src="../../assets/img/zuojiantou.png" alt="" @click="back">
        限时抢购
      </div>
      <!--   拼团分类   -->
      <div class="assembleList">
        <div v-for="(x,y) in assembleList"  class="abList_box" @click="isType(y)">
          <p>{{x.text}}</p>
          <transition name="el-zoom-in-center">
            <p v-show="y == present"></p>
          </transition>
        </div>
      </div>
    </header>
    <van-pull-refresh
      v-model="isLoading"
      success-text="刷新成功"
      @refresh="onRefresh"
    >
      <router-view></router-view>
    </van-pull-refresh>
  </div>
</template>

<script>
  export default {
    name: "panicBuy",
    data() {
      return {
        assembleList: [{text: '全部', page: '/components/ClientComponents/panicBuy/panicBuyAll'}, {text: '美食', page: 'panicBuyDelicious'}, {
          text: 'KTV',
          page: 'panicBuyKtv'
        }, {text: '景区', page: 'panicBuyScenicSpot'}, {text: '影院', page: 'panicBuyCinema'}],
        present: 0,
        isLoading: false,
      }
    },
    methods: {
      back() {
        this.$router.back();
      },
      onRefresh() {
        setTimeout(() => {
          this.$toast('刷新成功');
          this.isLoading = false;
        }, 100000);
      },
      isType(index){
        this.present = index;
      }
    }
  }
</script>

<style scoped>
  .assemble {
    padding-top: .8rem;
  }

  .assemble header {
    width: 100%;
    position: fixed;
    top: -.01rem;
    left: 0;
    z-index: 999;
    height: .81rem;
    background-image: url("../../../static/img/pt_juxing.png");
    background-size: 100% 120%;
    color: #ffffff;
    text-align: center;
  }

  .assemble_header {
    height: .5rem;
    width: 100%;
    position: relative;
    line-height: .5rem;
    font-size: .18rem;
  }

  .assemble_header img {
    width: .10rem;
    height: .18rem;
    position: absolute;
    left: .13rem;
    top: calc(50% - .09rem);
  }

  /* 拼团分类部分 */
  .assembleList {
    width: 100%;
    height: 100%;
    max-height: .3rem;
    display: flex;
    flex-flow: row;
    justify-content: space-between;
    align-items: center;
  }

  .abList_box {
    height: 100%;
    max-height: .3rem;
    width: calc(100% / 5);
    display: flex;
    flex-flow: column;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
    padding-bottom: .05rem;
  }

  .abList_box > p:nth-child(1) {
    color: #FFFEFE;
    font-size: .15rem;
  }

  .abList_box > p:nth-child(2) {
    width: .18rem;
    height: .02rem;
    background-color: #ffffff;
    border-radius: .01rem;
  }


  .el-loading-spinner {
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
    min-height: 5rem;
  }

/* 刷新适配 */
  >>> .van-pull-refresh__head {
    height: .5rem;
    font-size: .14rem;
    line-height: .5rem;
  }
  >>> .van-loading__spinner {
    width: .16rem;
    height: .16rem;
  }
  >>> .van-loading__text {
    margin-left: .08rem;
    font-size: .14rem;
  }
</style>
